source("connectivity.R")

funcfile <- "/data/projects/pro42/subjects/sub8005/func/lfo_res_noPWf2standard_8mm.nii.gz"
corprefix <- "/data/projects/pro42/test"
maskfile <- "/data/projects/pro42/masks/lfo_mask_8mm.nii.gz"

x <- read.nifti2mat(funcfile)
xcor <- nifticor(x, corprefix, m=maskname)

# NOT REALLY TEST
# Batch process correlations for 
source("connectivity.R")

funcnames <- as.character(as.matrix(read.table("../z_funclist_4mm.txt")))
cornames <- as.character(as.matrix(read.table("../z_corlist_4mm.txt")))
maskname <- "/data/projects/pro42/masks/lfo_mask_4mm.nii.gz"

library(doMC)
registerDoMC()
options(cores=12)

xcors <- batch.nifticor(funcnames, cornames, m=maskname)

xcors <- getnifticors(cornames, m=maskname)



xs <- batch.nifti2mat(funcnames, m=maskname, verbose=T)